package edu.lingnan.lingnanblog.controller;

import edu.lingnan.lingnanblog.entity.Blogger;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author wuyuan
 * @since 2020-06-13 22:25
 */
@RestController
@RequestMapping("consumer/blogger")
public class BloggerConsumerController {

    @Resource
    private RestTemplate restTemplate;

    private static final String REST_URL_PREFIX = "LINGNANBLOG-PROVIDER-BLOGGER";

    @RequestMapping("selectOne")
    public Blogger selectOne(@PathVariable("id") Integer id){
        return restTemplate.getForObject(REST_URL_PREFIX + "/blogger/selectOne/" + id, Blogger.class);
    }
}
